/* 以下为页面中的样式 */
.schema-node_row {
    position: relative;
    width: 100%;
    height: 32px;
    color: var(--ui-text-color);
    line-height: 32px;
    display: flex;
    flex-direction: row;
    box-sizing: border-box;
    border-bottom: 1px solid var(--app-bg-200);

    .schema-node_row_name {
        position: relative;
        height: 32px;
        display: flex;
        flex: 1 1 263px;
        flex-direction: row;
        align-items: center;

        .schema-node_row_drag {
            width: 16px;
            height: 32px;
            opacity: 0;
            display: flex;
            flex: 0 0 auto;
            background: url("/images/jsonSchema/drag.svg") center no-repeat;
            background-size: 100% auto;
            cursor: move;

            &:hover {
                background: url("/images/drag-hover.svg") center no-repeat;
                background-size: 100% auto;
            }
        }

        .schema-node-field_input_bg {
            position: relative;
            height: 32px;
            flex: 1 1;
            border-radius: 8px 0 0 8px;

            .schema-node-field_input_bg_bgItem {
                position: relative;
                height: 32px;
                display: flex;
                align-items: center;
                overflow: hidden;

                .schema-node-expand-icon {
                    width: 16px;
                    height: 32px;
                    display: flex;
                    flex: 0 0 auto;
                    background: url("/images/jsonSchema/right-angle.png") center no-repeat;
                    background-size: 60% auto;
                    cursor: pointer;

                    &:hover {
                        background: url("/images/jsonSchema/right-angle-hover.png") center no-repeat;
                        background-size: 60% auto;
                    }
                }

                .schema-node-expand-icon-active {
                    background: url("/images/jsonSchema/bottom-angle.png") center no-repeat;
                    background-size: 60% auto;

                    &:hover {
                        background: url("/images/jsonSchema/bottom-angle-hover.png") center no-repeat;
                        background-size: 60% auto;
                    }
                }

            }
        }
    }

    .schema-node-refer-to-schema{
        display: flex;
        align-items: center;
        flex: 2 0 272px;
        width: 272px;
        height: 32px;
        font-size: 14px;
        text-align: center;
        .schema-node-refer-to-schema__or{
            margin: 0px 8px 0px 8px;
        }
        .schema-node-refer-to-schema__refer{
            cursor: pointer;
            color: var(--app-primary-base);
        }
    }

    .schema-node-invalid-schema{
        display: flex;
        align-items: center;
        flex: 2 0 272px;
        width: 272px;
        height: 32px;
        font-size: 14px;
        text-align: center;
        .schema-node-invalid-schema__no_field{
            margin: 0px 8px 0px 8px;
        }
        .schema-node-invalid-schema__add{
            cursor: pointer;
            color: var(--app-primary-base);
        }
    }

    .schema-node_row_schemaType {
        display: flex;
        flex: 0 1 200px;
        gap: 2px;
        align-items: center;
        width: 200px;
        height: 32px;
        padding: 0 2px 0 4px;
        color: inherit;
        text-align: center;

        .schema-node-schema-type_typeSelect {
            order: 0;
            // max-width: 127px;
            max-width: 108px;
            height: 32px;
            overflow: hidden;
            font-size: 14px;
            line-height: 32px;
            text-align: left;
            white-space: nowrap;
            text-overflow: ellipsis;
            border-radius: 2px;
            cursor: pointer;
        }

        .schema-node-schema-check_box {
            display: inline-block;
            color: inherit;
            font-style: normal;
            line-height: 0;
            text-align: center;
            text-transform: none;
            text-rendering: optimizeLegibility;
            -webkit-font-smoothing: antialiased;
            font-size: 12px;


            svg {
                display: inline-block;
            }
        }


        // 按钮的checked状态
        .schema-type_checked-btn {
            background-color: var(--ui-component-background) !important;
        }

        .schema-node-schema-type_required,
        .schema-node-schema-type_nullable,
        .schema-node-type_morder-type {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 20px;
            height: 20px;
            padding: 0;
            background-color: var(--ui-item-hover-bg);
            border: 1px solid var(--ui-border-color-base);
            // background-color: rgba(16, 24, 40, 0.04);
            border-radius: 6px;
            margin-right: 1px;
            cursor: pointer;
        }

        .schema-node-schema-type_required {
            order: 1;
        }

        .schema-node-schema-type_nullable {
            order: 2;
        }

        .schema-node-type_morder-type {
            order: 3;
        }
    }

    .schema-node-row_title {
        position: relative;
        flex: 1 0 36px;
        max-width: 108px;
        color: inherit;
        height: 32px;
        display: flex;
        align-items: center;
    }

    .schema-node-row_description {
        position: relative;
        height: 32px;
        display: flex;
        flex: 1 0 54px;
        align-items: center;
        padding-right: 2px;
        color: inherit;
    }

    .schema-node-row_operation {
        height: 32px;
        display: flex;
        flex: 0 0 72px;
        align-items: center;

        .operation-btn {
            position: relative;
            width: 24px;
            height: 24px;
            padding: -1px 0;
            color: var(--ui-text-color);
            font-weight: 400;
            font-size: 14px;
            line-height: 22px;
            border-radius: 8px;
            border: 0 !important;
            outline: 0;
            vertical-align: -3px;
            display: flex;
            justify-content: center;
            align-items: center;
            white-space: nowrap;
            text-align: center;
            user-select: none;
            cursor: pointer;

            .app_icon {
                font-size: 15px;
                display: flex;
                justify-content: center;
                align-items: center;
                line-height: 0;
                color: inherit;
                font-style: normal;
                text-align: center;
            }

            &:hover {
                background-color: rgba(16, 24, 40, 0.04);
            }
        }
    }

    .schema-node-text {
        position: relative;
        width: 100%;

        .schema-node-text-wrapper {
            width: calc(100% - 2px);
            height: 32px;
            margin: 2px;
            padding: 2px 2px 2px 6px;
            color: var(--ui-text-color);
            display: flex;
            align-items: center;
            font-size: 14px;

            .schema-node-text-input {
                display: flex;
                align-items: center;
                width: 100%;
                height: 32px;
                min-width: 0;
                line-height: 22px;
                background-color: transparent;
                background-image: none;
                padding: 0;
                font-size: inherit;
                margin: 0;
                font-variant: tabular-nums;
                font-feature-settings: "tnum";
                list-style: none;
                color: var(--ui-text-color);
                touch-action: manipulation;
                border: 1px solid transparent; // 预占位

                &:hover {
                    border: 1px solid var(--ui-input-hover-border-color);
                    border-radius: 8px;
                    outline: none; //取消外方框
                    box-sizing: border-box;
                }
            }

            &:hover {
                border-color: var(--ui-border-color-base);
                border-right-width: 1px;
                z-index: 1;
            }
        }
    }

    &:hover {

        .schema-node-field_input_bg,
        .schema-node-refer-to-schema,
        .schema-node_row_schemaType,
        .schema-node-row_title,
        .schema-node-row_description,
        .schema-node-row_operation {
            background-color: var(--ui-table-row-hover-bg) !important;
        }
        .schema-node_row_drag {
            opacity: 1; // 透明度为1时表示显示，0时表示隐藏
        }
    }
}

.node-name,
.node-type,
.node-title,
.node-description {
    height: 28px;
    line-height: 28px;
    margin-left: 10%;
    display: inline-block;
    font-size: 14px;
    color: var(--ui-text-color);
}

.node-name {
    margin-left: 3px;
    width: 30%;

    .name-value-span {
        width: 300px;
        min-width: 100px;
        max-width: 300px;
        height: 32px;
        padding-left: 10px;
    }
}

.node-type {
    position: absolute;
    right: 45vw;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-left: 10px;

    .node-type-text {
        height: 100%;
        display: flex;

        span {
            pointer-events: auto;
            white-space: nowrap;
            /* 设置文字在一行显示，不能换行 */
            overflow: hidden;
            /* 文字长度超出限定宽度，则隐藏超出的内容 */
            text-overflow: ellipsis;
            /* 规定当文本溢出时，显示省略符号来代表被修剪的文本 */
        }

        span:nth-of-type(2) {
            display: block;
            width: 50px;
            height: 100%;
        }
    }

    .node-type-btn-null {
        display: none;
    }

    .btn-icon-center {
        display: block;
        width: 100%;
        height: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
    }
}

// 禁用
.schema-node_disabled {
    cursor: not-allowed !important;
}

// 禁用输入框
.schema-node-input_disabled {
    color: var(--ui-text-color);
    background: hsla(0, 0%, 100%, 0) !important;
    border-color: transparent !important;
    box-shadow: none;
    cursor: not-allowed;
    opacity: 1;
}

.schema-node-schema-type_typeSelect {
    .string-text {
        color: #139659;

        &:hover {
            border-bottom: 1px solid #139659;
        }
    }

    .integer-text,
    .number-text {
        color: #ee46bc;

        &:hover {
            border-bottom: 1px solid #ee46bc;
        }
    }

    .boolean-text {
        color: #f37acf;

        &:hover {
            border-bottom: 1px solid #f37acf;
        }
    }

    .array-text {
        color: #17b26a;

        &:hover {
            border-bottom: 1px solid #17b26a;
        }
    }

    .object-text {
        color: #2e90fa;

        &:hover {
            border-bottom: 1px solid #2e90fa;
        }
    }

    .any-text {
        color: #69affb;

        &:hover {
            border-bottom: 1px solid #69affb;
        }
    }

    .ref-text {
        color: #409EFF;

        &:hover {
            border-bottom: 1px solid #409EFF;
        }
    }

    .null-text,
    .dictionary-text {
        color: #ef6820;

        &:hover {
            border-bottom: 1px solid #ef6820;
        }
    }
}

.quote-header {
    display: none;
    position: absolute;
    top: -24px;
    left: calc(50% + 13px);
    max-width: calc(100% - 30px);
    height: 24px;
    font-size: 14px;
    align-items: center;
    padding: 0 14px;
    background-color: var(--jsonSchemaEditor--bg);
    border-radius: 6px 6px 0 0;
    transform: translateX(-50%);
    z-index: 10;
    overflow: hidden;
    box-sizing: border-box;

    .quote-header-item {
        color: var(--ui-text-color);
        display: flex;
        align-items: center;
        margin-right: 12px;
        text-overflow: ellipsis;
        flex-shrink: 0;
        overflow: hidden;
        white-space: nowrap;
        box-sizing: border-box;
        cursor: pointer;

        span {
            margin-right: 5px;
            display: inline-block;
            max-width: 250px;
            // height: 18px;
            text-overflow: ellipsis;
            color: var(--ui-text-color);
            flex-shrink: 0;
            font-size: 14px;
            font-style: normal;
            text-align: center;
            text-transform: none;
            vertical-align: -1.25em;
            overflow: hidden;
            white-space: nowrap;
            box-sizing: border-box;

            &:last-of-type {
                margin-right: 0;
            }
        }
    }
}

.quote-box {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0;
    pointer-events: none;
    border: 1px solid var(--jsonSchemaEditor--bg);
    border-radius: 6px;
    box-sizing: border-box;
}

.quote-drag {
    display: none;
    position: absolute;
    top: 50%;
    bottom: 0;
    left: 0;
    right: 0;
    width: 16px;
    height: 32px;
    z-index: 2;
    align-items: center;
    background-color: #fff;
    border-radius: 50%;
    background: url("/images/jsonSchema/drag.svg") center no-repeat;
    background-size: 100% 100%;
    cursor: move;

    &:hover {
        background: url("/images/drag-hover.svg") center no-repeat;
        background-size: 100% 100%;
    }
}

/* 以下为更新第三方组件的样式 */
.schema-node-text-wrapper>input:focus-visible {
    padding-left: 1px;
    outline: 1px solid #afb3b9;
    border-radius: 8px;
}